package com.gitee.grower.core.kether

import ac.github.oa.internal.core.item.ItemPlant
import com.gitee.grower.ItemGrowerAPI
import com.gitee.grower.ItemGrowerAPI.growLevel
import org.bukkit.entity.Player
import org.bukkit.inventory.ItemStack
import taboolib.module.nms.getName

enum class ItemField {

    NAME {
        override fun get(player: Player?, itemStack: ItemStack): Any? {
            return itemStack.getName(player)
        }
    },
    TYPE {
        override fun get(player: Player?, itemStack: ItemStack): Any? {
            return itemStack.type.name
        }

    },
    LORE {
        override fun get(player: Player?, itemStack: ItemStack): Any? {
            return itemStack.itemMeta?.lore ?: emptyList<String>()
        }
    },
    ID {
        override fun get(player: Player?, itemStack: ItemStack): Any? {
            return ItemPlant.parseItem(itemStack)?.key
        }
    },
    LEVEL {
        override fun get(player: Player?, itemStack: ItemStack): Any? {
            return itemStack.growLevel()
        }
    };


    abstract fun get(player: Player?, itemStack: ItemStack): Any?

}